home *** CD-ROM | disk | FTP | other *** search
/ Floppyshop 2 / Floppyshop - 2.zip / Floppyshop - 2.iso / diskmags / 5791-.end / dmg-6260 / articles / bankappn.doc < prev    next >
Text File  |  1993-07-24  |  4KB  |  102 lines

  1.                    BLACK EAGLE'S BANK APPENDER
  2.                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3.  
  4. This is another little utility that  I  have  written. As you must well
  5. know, STOS has a maximum of  15  memory  banks.  But what if you had 16
  6. packed picture files, or 20 pieces of music, or 25 samples???
  7.  
  8. This utility can take lots of  files  and  make them into one big file.
  9. All you need to do is  remember  the  lengths and offsets of each file,
  10. which can be listed at any time. There is also an extra feature here. I
  11. had recently been watching '2010' on  the  telly, and H.A.L. gave me an
  12. idea. Most actions are now  accompanied  by  my  sampled speech! I even
  13. read out the lengths of files to you! (Oh dear)
  14.  
  15. You are primarily presented with the  main menu. Here, you have several
  16. options:
  17.  
  18. LOAD BANK   (adds another file to the current bank)
  19. SAVE BANK   (saves the whole chunk)
  20. INFORMATION (provides you with the numbers, lengths, names, and offsets
  21.              of each file in the bank)
  22. DELETE      (erases any one file from the databank, and closes the
  23.              empty gap)
  24. CLEAR       (erases all of the data)
  25. QUIT        (quits)
  26. STOS BANK?  (toggles STOS Bank on/off - see later on)
  27. CHANGE DRIVE allows you to change from drive A to B and back.
  28. SAVE INFO-BLOCK saves a list of the offsets and lengths.
  29. PACK FILE actually compacts a datablock, using the SQUASHER packer.
  30.  
  31. There is an option to toggle  STOS  Bank  on/off.  This is for use with
  32. propor STOS Banks, like packed  pictures, sprites, icons, etc. Non-STOS
  33. Banks are things like pictures,  samples,  binary data, etc. Generally,
  34. when you ask to save the data, it either SAVEs it or BSAVEs it.
  35.  
  36. Here is an example of how to use an appended bank:
  37.  
  38. Say you had 10 packed pictures you wanted  for a game, and, due to also
  39. needing music, samples, sprites etc. you had nowhere near enough memory
  40. banks to include them all. You would load each packed picture file into
  41. my appender, and make them all  into  one  file. Before you leave, view
  42. the information screen, and you will get a list of numbers. Get a piece
  43. of paper and write down the  lengths  and offsets against each filename
  44. in the bank. Number each file.
  45.  
  46. Load up your game so far, and  set  up  two arrays, one for offsets and
  47. one for lengths.  Now,  include  a  routine   to  list  the offsets and
  48. lengths into the arrays (probably  by  using DATA statements). Finally,
  49. you are going to need  an  extra  routine  which will copy the required
  50. block of  data  into  an  empty  bank,  ready  for  unpacking, viewing,
  51. playing, or whatever.
  52.  
  53. So, let's say we had created the following appended bank:
  54.  
  55. NUMBER    FILENAME      OFFSET    LENGTH
  56. ----------------------------------------
  57.   1       title.mbk      $0        6144
  58.   2       options.mbk    $1800     10240
  59.   3       gameover.mbk   $4000     8704
  60.   4       loselife.mbk   $6200     10240
  61.   5       cheat.mbk      $8A00     5120
  62.  
  63. Now, sometime during my game,  I  want  to  unpack and display the GAME
  64. OVER picture. I would have a routine  which extracts just the GAME OVER
  65. picture from the main bank, copies it  to a spare bank, unpacks it, and
  66. displays it:
  67.  
  68. 10 dim o(5),l(5)
  69. 20 restore 40
  70. 30 for t=1 to 5 : read o(t) : next t
  71. 40 data 0,$1800,$4000,$6200,$8A00
  72. 50 for t=1 to 5 : read l(t) : next t
  73. 60 data 6144,10240,8704,10240,5120
  74. 70 :
  75. 80 :
  76. 100 rem MAIN GAME GOES HERE.....
  77. 110 :
  78. 645 rem I WANT TO DISPLAY THE 'GAME OVER' PICTURE HERE
  79. 646 :
  80. 647 NUM=3 : rem (GAME OVER is the 3rd block of data)
  81. 648 gosub 1000 : rem MY NIFTY EXTRACTING ROUTINE
  82. 649 rem DATA IS RETURNED IN BANK 11 WHICH IS RESERVED FOR SOLELY THIS
  83.         PURPOSE
  84. 650 unpack 11,physic
  85. 651 rem CARRY ON.
  86. 1000 rem MY NIFTY EXTRACTING ROUTINE...
  87. 1001 fill start(11) to start(11)+length(11),0
  88. 1002 rem Clears the return bank
  89. 1003 kopy start(6)+o(num),start(11),l(num)
  90. 1004 rem Bank 6 holds the massive bank.
  91. 1005 return
  92.  
  93. There we are...
  94.  
  95. The datablock for the above  example  would  have  been saved with STOS
  96. Bank ON. You CAN mix data  types  in  one  bank;  like a sample, then a
  97. picture, then a sprite bank, then some music. But remember, if there is
  98. at least one STOS bank, then the whole  lot  will have to be saved as a
  99. STOS Bank. (There is no length disadvantage or anything when using STOS
  100. Banks)
  101.  
  102.